package com.appstore.util;

public class FileNameUtil {

	public static String getExtention(String fileName) {
		int pos = fileName.lastIndexOf(".");
		if (pos != -1) {
			return fileName.substring(pos);
		} else {
			return "";
		}
	}

	public static String getFileName(String fileName) {
		int begin = fileName.lastIndexOf("/");
		int end = fileName.lastIndexOf(".");
		if (begin == -1) {
			begin = 0;
		} else {
			begin += 1;
		}
		if (end == -1) {
			end = fileName.length();
		}
		return fileName.substring(begin, end);
	}
}
